<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
 		<title></title> 
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<jsp:include page="/page/front/include.jsp"></jsp:include>
		<link rel="stylesheet" type="text/css" href="css/front/book.css" />
		<link rel="stylesheet" type="text/css" href="css/front/transaction.css" />
		<link rel="stylesheet" type="text/css" href="css/front/cart.css" />
	</head>
	<body class="cartItemList">
		<jsp:include page="/page/front/header.jsp"></jsp:include>
		<div class="body">
			<div class="shopGuideBar"></div>
			<div class="blank"></div>
			<div class="cartItemListDetail">
				<div class="top">
					<div class="topLeft"></div>
					<div class="topMiddle">购物车中的商品：</div>
					<div class="topRight"></div>
				</div>
				<form class="middle" action="fillOrderInfo.do" method="post">
					<table class="listTable">
						<tbody>
							<tr>
								<th colspan="2">商品</th>
								<th>销售价格</th>
								<th>数量</th>
								<th>小计</th>
								<th>操作</th>
							</tr>
							<s:set name="totalQuantity" value="0"></s:set>
							<s:set name="totalCharge" value="0"></s:set>
							<s:iterator value="#session.cart" status="st">
							<tr>
								<s:set name="bookID" value="book.bookID"></s:set>
								<td class="itemImage">
									<a href='viewBook.do?id=<s:property value="#bookID" />' target="_blank">
										<img src='<s:property value="book.picPath" />'>
									</a>
								</td>
								<td class="itemTitle">
									<a href='viewBook.do?id=<s:property value="#bookID" />' target="_blank">
										<s:property value="book.title" />
									</a>
								</td>
								<s:set name="itemPrice" value="book.price"></s:set>
								<td class="itemPrice">￥<s:property value="#itemPrice" /></td>
								<s:set name="itemQuantity" value="quantity"></s:set>
								<td><input type="text" name='booksQuantity[<s:property value="#st.index" />]' class="formText quantity" value='<s:property value="#itemQuantity" />'></td>
								<s:set name="itemCharge" value="#itemPrice*#itemQuantity"></s:set>
								<td class="itemCharge">￥<s:property value="#itemCharge" /></td>
								<td><a class="deleteCartItem" href='removeCartBook.do?id=<s:property value="#bookID" />'>删除</a></td>
								<s:set name="totalQuantity" value="#totalQuantity+#itemQuantity"></s:set>
								<s:set name="totalCharge" value="#totalCharge+#itemCharge"></s:set>
							</tr>
							</s:iterator>
							<tr>
								<td class="info" colspan="6">
									商品共计：<span class="red"><s:property value="#session.cart.size" /></span>种
									，<span class="red"><s:property value="#totalQuantity" /></span>件
									；商品总金额：<span class="red">￥<s:property value="#totalCharge" /></span>元
								</td>
							</tr>
						</tbody>
					</table>
					<div class="blank"></div>
					<a class="continueShopping" href=""><span class="icon">&nbsp;</span>继续购物</a>
					<a class="clearCartItem" href="clearCart.do"><span class="icon">&nbsp;</span>清空购物车</a>
					<input type="submit" class="formButton" value="去结算" hidefocus="true" />
					<div class="clearfix"></div>
				</form>
				<div class="bottom">
					<div class="bottomLeft"></div>
					<div class="bottomMiddle"></div>
					<div class="bottomRight"></div>
				</div>
			</div>
		</div>
		<jsp:include page="/page/front/footer.jsp"></jsp:include>
	</body>
</html>
